#region Microsoft Public License
/*
 * (c) Copyright Chenjun Wu. http://utablesdk.codeplex.com
 * 
 * This source is subject to the Microsoft Public License (Ms-PL).
 * Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
 * All other rights reserved.
 */
#endregion

using UTable.Input;
using UTable.Input.MultiTouch;

namespace UTable.Objects
{
    /// <summary>
    /// the abstract representation of an element that can receive input
    /// </summary>
    public interface IInputNode
    {
        /// <summary>
        /// Raise the input events on this node
        /// Warning: this method is for internal use. Clients should not call it.
        /// </summary>
        /// <param name="e"></param>
        void RaiseEvent(InputEventArgs e);

        /// <summary>
        /// Invoked when this object received input
        /// </summary>
        /// <param name="args"></param>
        void OnInputReceived(InputEventArgs args);

        /// <summary>
        /// Try to capture the finger.
        /// If the finger is captured by this node, all the following events raised by 
        /// this finger will be sent to this node
        /// </summary>
        /// <param name="fingerId">The id of the finger to capture</param>
        /// <returns>true if the finger is captured, otherwise false</returns>
        bool CaptureFinger(int fingerId);

        /// <summary>
        /// Try to uncapture the finger
        /// </summary>
        /// <param name="fingerId">The id of the finger to uncapture</param>
        /// <returns>true if the finger is uncaptured, otherwise false</returns>
        bool UncaptureFinger(int fingerId);

        /// <summary>
        /// Invoked when this object captured an finger
        /// </summary>
        event FingerEventHandler GotFingerCapture;

        /// <summary>
        /// Invoked when this object lost finger capture
        /// </summary>
        event FingerEventHandler LostFingerCapture;

        /// <summary>
        /// Invoked when this object received input
        /// </summary>
        event InputEventHandler InputReceived;
    }
}
